# Author    : CoffeeChicken
# Date      : 2020-10-06 13:54
# Function  : 演示 使用requests下载图片

import requests

url = "https://scontent-hkg4-1.cdninstagram.com/v/t51.2885-15/e35/s1080x1080/118884452_666919493949835_" \
      "3852558908158762030_n.jpg?_nc_ht=scontent-hkg4-1.cdninstagram.com&_nc_cat=107&_nc_ohc=xyKx4_" \
      "UfnuIAX-0PrlN&_nc_tp=15&oh=148a29e35846f7932d73bfd5b876c860&oe=5FA3D90D"

res_img = requests.get(url)

# response三个属性
# 1. text返回字符串
# 2. content返回二进制数据
# 3. json返回json对象(可转换为字典类型)

with open("pic1.jpg", 'wb') as fp:
    fp.write(res_img.content)
